﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PersonCallLogView.aspx.cs" Inherits="JKF.Web.SMS.CALL.PersonCallLogView" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
        <%= RegScript("~/js/jquery.1.5.js")%>
        <%=RegScript("~/js/Common.js")%>
        <%=RegScript("~/js/jquery.json.js")%>
        <%=RegScript("~/js/jquery.nhis.js")%>
        <%=RegScript("~/js/jquery.rchis.js")%>
        <%=RegScript("~/js/jquery.validate.js")%>
        <%=RegScript("~/js/DatePicker/WdatePicker.js")%>
        <%=RegStyle("~/js/suggest/jquery.suggest.css")%>
        <%= RegScript("~/js/jquery-ui-custom.min.js")%>
    <script src="../../js/Uppop/tipswindown2.js"  type="text/javascript"></script>
        
    <link href="../../App_Themes/Theme2/Include.css"   rel="stylesheet" type="text/css" />  
    
    <script type="text/javascript" language="javascript">
        var isView = '<%=IsView%>'; //是否有浏览权限
        var isDelete = '<%=IsDelete%>' == 'True' ? '' : 'none'; // 是否具有删除权限

        var AppPath = '<%=AppPath %>';
        var handler = AppPath + '/do/SMS/Call_Log.do';
        var customerKey = '<%=P("customerKey") %>'; //人员主键

        $(function () {
            bindPointLog();
        });

        function bindPointLog() {
            var tbody = $('#tb tbody');
            tbody.empty();

            $.ajax({ global: true, url: handler, data: { ActionName: "GetCALL_LOGS", CUSTOMER_KEY: customerKey }, success: function (data) {
                if (data.error == true) {
                    ShowWarn(data.message);
                }
                else {
                    var tbody = $('#tb tbody');
                    tbody.empty();
                    if (data && data.Entity && data.Entity.length) {
                        data = data.Entity
                        var tr, td;
                        for (var i = 0; i < data.length; i++) {
                            var item = data[i];
                            tr = $("<tr key=" + item.ID + "></tr>").appendTo(tbody);

                            $('<td width="100px"></td>').appendTo(tr).html('<input name="" type="button" class="common_btn_del mr12" style="display:<%=DispDelete%>" />');
                            $('<td width="100px"></td>').appendTo(tr).text(item.CARD_NO); // 卡号
                            $('<td width="100px"></td>').appendTo(tr).text(item.NAME); // 姓名
                            $('<td width="100px"></td>').appendTo(tr).text(item.PHONE); // 通话号码
                            $('<td width="120px"></td>').appendTo(tr).text(item.CALL_DATE); // 通话日期
                            $('<td width="200px"></td>').appendTo(tr).text(item.CONTENT); // 通话内容
                            $('<td width="100px"></td>').appendTo(tr).text(item.MEMO); // 备注 
                        }
                    } else {
                        tbody.html('<tr id="emptyTr"><td colspan="9" style="text-align: center">没有数据!</td></tr>');
                    }
                    // 删除一条记录
                    $('input.common_btn_del').live('click', function () {
                        if (!confirm("确认删除吗?")) {
                            return false;
                        }
                        var tr = $(this).parent().parent();
                        $.post(handler, { ActionName: 'DeleteCALL_LOG', id: tr.attr('key') }, function (obj) {
                            if (obj.MessageCode == "Error") {
                                alert(obj.Message);
                                return;
                            } //else if (obj.MessageCode == "2") {
                            //alert("删除失败。\r\n原因：总店创建产品分店无权删除！只能查看");
                            //}
                            else if (obj.MessageCode == "Ok" && obj.Success) { // 返回1，才允许删除
                                tr.remove();
                            }
                        }, 'json');
                    });
                }
            }, dataType: "json", type: "POST", async: true
            });
        }

         
    </script>  
</head>
<body id="modulebody">
      <div class="index_table">
        <div >
            <table border="0" cellspacing="0" cellpadding="0"  width="800" class="common_table">
                <thead>
                    <tr>
                         <th width="100px" orderaction="false">操作</th>
                             <th width="100px" ordertype="string">卡号</th>
                            <th width="100px" ordertype="string">姓名</th>
                             <th width="100px" ordertype="string">通话号码</th>
                            <th width="120px" ordertype="string">通话日期</th>
                             <th width="200px" ordertype="string">通话内容</th>
                              <th width="100px" ordertype="string">备注</th>
                    </tr>
                </thead>
            </table>
            <div style="width:800px;height:450px;overflow:auto;overflow-x:hidden;">
                <table id="tb" width="800" border="0" cellspacing="0" cellpadding="0"  class="common_table">
                  <tbody>
                       <tr>
                        <td colspan="9" style="text-align: center">暂无数据</td>
                       </tr>
                  </tbody>
                </table>
            </div>
        </div>
    </div>
</body>
</html>
